#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QtWidgets>

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void loadFile(const QString &fileName);
protected:
    void closeEvent(QCloseEvent *event) override;
private slots:
    void newFile();
    void open();
    void setCurrentFile(const QString &fileName);
    bool maybeSave();
    bool save();
    bool saveAs();
    void about();
    void documentWasModified();
#ifndef QT_NO_SESSIONMANAGER
      void commitData(QSessionManager &);
  #endif
private:
    bool saveFile(const QString &fileName);
    void createActions();
    void createStatusBar();
    void readSettings();
    void writeSettings();
private:
    QPlainTextEdit *textEdit;
    QString curFile;
};
#endif // MAINWINDOW_H
